#ifndef KZF_CONFIG_H
#define KZF_CONFIG_H

#include <QString>
#include <QDebug>

#include <QFile>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonValue>
#include <QJsonParseError>

/*
    使用json文件作为配置文件

*/

/*
    json格式
{
    "config" : {
        "user" : "root",
        "pwd" : "123456",
        "version" : "1.0.0"
    },

    "camera":{
        "name" : "web-12345",
        "type" : "usb",
        "width" : 640,
        "height" : 480,
        "pixelRatio" : 100,
        "pixelSize" : 2.5,
        "" : "",
    },
}
*/


class kzf_config
{
public:
    QJsonObject RconfigJson;
    QJsonObject WconfigJson;

    QString user;
    QString version;

    QString cameraName;
    QString cameraType;
    int cameraWidth;
    int cameraHight;
    double umPerPixel;
    double pixelSize;

public:
    kzf_config();

    bool readJsonFileToRootObject(QString path);
    bool analysisJsonData();
    bool dataToJson();
    bool writeRootObjectToJsonFile(QString path);
};

#endif // KZF_CONFIG_H
